package com.googlecode.kipler.transformations;

import java.util.List;

import com.googlecode.kipler.container.dl.ABox;
import com.googlecode.kipler.syntax.concept.CardinalityRestriction;
import com.googlecode.kipler.syntax.concept.Concept;
import com.googlecode.kipler.syntax.concept.Nominal;

public class Transformations {

	public static ABox transformCRToABox(
			List<CardinalityRestriction> restrictions) {
		CardinalityRestrictionsToABox translator = new CardinalityRestrictionsToABox();
		return translator.transform(restrictions);
	}

	public static Concept replaceNominals(Concept c, String replaceBy,
			String replaced) {
		NominalReplacingVisitor visitor = new NominalReplacingVisitor(
				replaceBy, replaced);
		c.accept(visitor);
		return visitor.getResult();
	}

	public static boolean hasNominal(Concept c, Nominal n) {
		NominalSearchingVisitor visitor = new NominalSearchingVisitor(n);
		c.accept(visitor);
		return visitor.hasNominal();
	}

	public static Concept simplify(Concept c) {
		ConceptSimplificationVisitor visitor = new ConceptSimplificationVisitor();
		c.accept(visitor);
		return visitor.getNormalForm();
	}
}
